#ifndef PARTICLEFILTER_H
#define PARTICLEFILTER_H

#include <QObject>
#include <QVector>

#include "Sample.h"

#ifdef WIN32
    #define M_PI 3.1415926535897932384
#endif

class Observation;
class RandomDistribution;

class ParticleFilter : public QObject
{
    Q_OBJECT
public:
    ParticleFilter();
    ~ParticleFilter();

signals:
    void resultReady(double meanX, double meanY, double varX, double varY);

public slots:
    void reset();
    void start(QVector<Observation>& observations, int numberOfSamples);

private:
    void performLikelihoodWeighting(Observation& observation, int numberOfSamples);
    void performSystemTransition();
    void resample(QVector<double>& likelihoods);

    QVector<Sample> bagOfSamples;
    RandomDistribution* randomDistribution;

};

#endif // PARTICLEFILTER_H
